package sandbox;

import gms.View;
import gms.ViewValidationService;

import java.util.ArrayList;

/**
 * This is a test to make sure that the validation service is running as 
 * expected. What you should observe is the service killing montreal002
 * and montreal001 views. View 3 (montreal003) remains in the view list
 * since it updates each iteration.
 * 
 * @author psyomn
 */

public class ViewServicesExample
{
	public static void main(String[] args)
	{
		Thread t;
		View v1 = new View("hosntame.encs.concordia", "montreal001");
		View v2 = new View("hosntame2.encs.concordia", "montreal002");
		View v3 = new View("hosntame3.encs.concordia", "montreal003");
		ViewValidationService vvs; 
		ArrayList<View> vArr = new ArrayList<View>();
		
		vArr.add(v1);
		vArr.add(v2);
		vArr.add(v3); 
		
		vvs = new ViewValidationService(vArr); 
		
		t = new Thread(vvs); 
		t.start(); 
		
		while(true)
		{
			try
      {
	      Thread.sleep(1100);
	      System.out.print(".");
	      v3.update();
	  		vArr.add(v1);

      } 
			catch (InterruptedException e)
      {
	      e.printStackTrace();
      }
		}
		
	}
}
